//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#include "Script/ScriptEngine.h"
#include <ObjectScript/objectscript.h>


namespace Engine
{
namespace Script
{
	
/*
=================================================
	constructor
=================================================
*/
	ScriptEngine::ScriptEngine (const EngineSubSystemsRef ess) :
		BaseObject(ess), _initialized(false)
	{
	}

/*
=================================================
	destructor
=================================================
*/
	ScriptEngine::~ScriptEngine ()
	{
		if ( _objScr.IsNotNull() )
		{
			_objScr.ToPtr< ObjectScript::OS >()->release();
			_objScr = null;
		}
	}
	
/*
=================================================
	Init
=================================================
*/
	bool ScriptEngine::Init ()
	{
		if ( _initialized )
		{
			WARNING( "reinitialization" );
			return true;
		}

		_objScr = (_ObjectScript_t *) ObjectScript::OS::create();

		_initialized = true;
		return _initialized;
	}


}	// Script
}	// Engine
